<?php



require ROOT_PATH.'/Helper/admin_abstract.php';

class Action extends admin_abstract
{
    function __call($id, $param = array())
    {
        $admin_group = $this->get_admin_group();
        $info = $admin_group[$id];
        if (Request::isPost()) {
            $modules = _POST('modules', array());
            $modules = array_filter($modules);
            _model('user_group')->update(array('id'=>$id), array('modules' => implode('|', $modules)));
            $this->cache->delete('admin_group');
            $this->msg('Save was successful!', 'admin/user_group.html');
        } else {
            $this->view->assign('info', $info);
            $this->view->display('admin/user_group_action.html');
        }
    }

    function index()
    {
        $this->view->assign('admin_group', $this->get_admin_group());
        $this->view->display('admin/user_group.html');
    }
}


?>